import Vue from 'vue';
import VueRouter from 'vue-router';

const Home = () => import('../components/Home');
const NotFound = () => import('../components/NotFound');
const CallMe = () => import('../components/CallMe');
const Find = () => import('../components/Find');
const GoodsDetail = () => import('../components/GoodsDetail');
const GoodsList = () => import('../components/GoodsList');
const PersonalCenter = () => import('../components/PersonalCenter');
const PhotoShareDetail = () => import('../components/PhotoShareDetail');
const PhotoShareList = () => import('../components/PhotoShareList');
const Search = () => import('../components/Search');
const Shopcart = () => import('../components/Shopcart');

Vue.use(VueRouter);

export default new VueRouter({
    routes: [
        {
            path: '/',
            redirect: { name: 'home' },
        },
        {
            name: 'home',
            path: '/home',
            component: Home,
        },
        {
            name: 'callme',
            path: '/callme',
            component: CallMe,
        },
        {
            name: 'find',
            path: '/find',
            component: Find,
        },
        {
            name: 'goods-detail',
            path: '/goods-detail/:id',
            component: GoodsDetail,
        },
        {
            name: 'goods-list',
            path: '/goods-list/:pageindex',
            component: GoodsList,
        },
        // {
        //     name: 'news-detail',
        //     path: '/news-detail',
        //     component: NewsDetail,
        // },
        // {
        //     name: 'news-list',
        //     path: '/news-list',
        //     component: NewsList,
        // },
        {
            name: 'personal-center',
            path: '/personal-center',
            component: PersonalCenter,
        },
        {
            name: 'photo-share-detail',
            path: '/photo-share-detail/:id',
            component: PhotoShareDetail,
        },
        {
            name: 'photo-share-list',
            path: '/photo-share-list',
            component: PhotoShareList,
        },
        {
            name: 'search',
            path: '/search',
            component: Search,
        },
        {
            name: 'shopcart',
            path: '/shopcart',
            component: Shopcart,
        },
        {
            name: 'comment',
            path: '/comment',
            component: () => import('../global-components/Comment'),
        },
        {
            path: '*',
            component: NotFound,
        },
    ],
});